<?php
/**
 * Created by PhpStorm.
 * User: poptser@foxmail.com
 * Date: 2018/1/24
 * Time: 14:22
 */

namespace App\Address\Validators;

use \Prettus\Validator\Contracts\ValidatorInterface;
use \Prettus\Validator\LaravelValidator;

class UserAddressValidator extends LaravelValidator
{

    protected $rules = [
        ValidatorInterface::RULE_CREATE => [
            'address_name' => 'required|max:20',
            'user_id'  => 'required',
            'consignee'=> 'required|max:10',
            'province'=> 'required',
            'city'=> 'required',
            'district'=> 'required',
            'address'=> 'required',
            'mobile'=> 'required',
            'sign_building'=> 'required',
            'longitude'=> 'required',
            'latitude'=> 'required',
            'sex'=> 'required',
            'address_tag'=> 'required'
        ],
        ValidatorInterface::RULE_UPDATE => [
            'address_name' => 'required|max:20',
            'user_id'  => 'required',
            'consignee'=> 'required|max:10',
            'province'=> 'required',
            'city'=> 'required',
            'district'=> 'required',
            'address'=> 'required',
            'mobile'=> 'required',
            'sign_building'=> 'required',
            'longitude'=> 'required',
            'latitude'=> 'required',
            'sex'=> 'required',
            'address_tag'=> 'required'
        ],
    ];


    protected $messages = [
        'address_name.required'=>'address_name 不可为空',
        'address_name.max:20'=>'address_name 最大长度为20位',
    ];

}
